package com.rybbaby.tss.front.tssRightStatistic.controller;

import com.rybbaby.tss.core.annotation.RequestLog;
import com.rybbaby.tss.core.annotation.Token;
import com.rybbaby.tss.core.annotation.validator.RegexpValidator;
import com.rybbaby.tss.core.annotation.validator.StringValidator;
import com.rybbaby.tss.core.bean.PageBean;
import com.rybbaby.tss.core.consts.RoleConsts;
import com.rybbaby.tss.core.hqlsearch.HqlGenerateUtil;
import com.rybbaby.tss.core.utils.AjaxJsonResponse;
import com.rybbaby.tss.core.utils.PropertiesReadUtil;
import com.rybbaby.tss.core.utils.SequenceUtil;
import com.rybbaby.tss.core.utils.StringUtils;
import com.rybbaby.tss.core.web.controller.BaseController;
import com.rybbaby.tss.front.tssRightStatistic.entity.*;
import com.rybbaby.tss.front.tssRightStatistic.service.ITssRightStatisticService;
import com.rybbaby.tss.platform.sysAdminUser.entity.SysAdminUser;
import com.rybbaby.tss.platform.sysAdminUser.service.ISysAdminUserService;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.io.IOException;
import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * @description 权责收入管理
 * 
 * @author 雷春琼
 * 
 * @createDate 2017-08-10 上午12:23:36
 */
@Controller
@RequestMapping(value = "tssRightStatisticController")
public class TssRightStatisticController extends BaseController {
	
	@Autowired
	private ITssRightStatisticService tssRightStatisticService;
	@Autowired
	private ISysAdminUserService sysAdminUserService;
	
	/**
	 * 获取权责收入列表
	 * 
	 * @return
	 * @throws IOException
	 */
	@RequestLog(content = "获取权责收入列表" , save = true)
	@Token(validateToken = false)
	@RequestMapping(value = "tssRightStatisticList" , method = RequestMethod.POST)
	public ModelAndView tssRightStatisticList(TssRightStatistic entity , PageBean paramPageBean) {
		ModelAndView mav = new ModelAndView(PropertiesReadUtil.getStringProperty("tssRightStatisticListView"));
		try {
			Map<String , String []> unLockMap = getParameterMap(request);
			DetachedCriteria dc = DetachedCriteria.forClass(TssRightStatistic.class);
			HqlGenerateUtil.fillDetachedCriteria(dc , entity , unLockMap);
			PageBean pageBean = tssRightStatisticService.pageList(dc , paramPageBean.getPageNo() , paramPageBean.getPageSize());
			mav.addObject(super.SEARCH_MAP , unLockMap);
			mav.addObject(super.PAGE_BEAN , pageBean);
			mav.addObject("searchFormId" , SEARCH_FORM);
			mav.addObject("actionUrl" , request.getRequestURI());
			mav.addObject("pagingBar" , pageBean.getPagingBar(SEARCH_FORM));
			mav.addObject("serializeNum" , SequenceUtil.getUpperCaseUUID());
			String requestURI = StringUtils.substringBeforeLast(request.getRequestURI() , "/");
			mav.addObject("editUrl" , requestURI + "/toEditView.do");
			mav.addObject("deleteUrl" , requestURI + "/delete.do");
			mav.addObject("batchDeleteUrl" , requestURI + "/batchDelete.do");
		} catch (Exception e) {
			throw e;
		}
		return mav;
	}
	/**
	 * 获取权责流水列表
	 *
	 * @return
	 * @throws IOException
	 */
	@RequestLog(content = "获取权责流水列表" , save = true)
	@Token(validateToken = false)
	@RequestMapping(value = "viewResponsibilityTurnover" , method = RequestMethod.POST)
	public ModelAndView viewResponsibilityTurnover(ViewResponsibilityTurnover entity , PageBean paramPageBean) {
		ModelAndView mav = new ModelAndView(PropertiesReadUtil.getStringProperty("viewResponsibilityTurnoverView"));
		try {
			Map<String , String []> unLockMap = getParameterMap(request);
			DetachedCriteria dc = DetachedCriteria.forClass(ViewResponsibilityTurnover.class);
			HqlGenerateUtil.fillDetachedCriteria(dc , entity , unLockMap);
			//获取当前登录者
			String adminUserId = super.getLoginUser().getId();
			SysAdminUser user = super.getLoginUser();
			String ids = "";
			SysAdminUser sysAdminUser=this.sysAdminUserService.get(adminUserId);
			//获取当前登录者所拥有角色
			List<String> roleList = super.getLoginAdminRoles();

			if(roleList.contains(RoleConsts.TSS_COUNSELOR)||roleList.contains(RoleConsts.TSS_TEACHER)){
				dc.add(Restrictions.sqlRestriction(" adminUserId in ('" + adminUserId + "') "));
			} else{
				List<String> idsList = super.getUserIdByRoleAndSchololId(sysAdminUser.getSchoolId());
				ids = StringUtils.join(idsList, "','");
				dc.add(Restrictions.sqlRestriction(" adminUserId in ('" + ids + "') "));
			}
			PageBean pageBean = tssRightStatisticService.pageList(dc , paramPageBean.getPageNo() , paramPageBean.getPageSize());
			mav.addObject(super.SEARCH_MAP , unLockMap);
			mav.addObject(super.PAGE_BEAN , pageBean);
			mav.addObject("searchFormId" , SEARCH_FORM);
			mav.addObject("actionUrl" , request.getRequestURI());
			mav.addObject("pagingBar" , pageBean.getPagingBar(SEARCH_FORM));
			mav.addObject("serializeNum" , SequenceUtil.getUpperCaseUUID());
			String requestURI = StringUtils.substringBeforeLast(request.getRequestURI() , "/");
			mav.addObject("editUrl" , requestURI + "/toEditView.do");
			mav.addObject("deleteUrl" , requestURI + "/delete.do");
			mav.addObject("batchDeleteUrl" , requestURI + "/batchDelete.do");
		} catch (Exception e) {
			throw e;
		}
		return mav;
	}
	/**
	 * 获取权责记录亲子考勤列表
	 *
	 * @return
	 * @throws IOException
	 */
	@RequestLog(content = "获取权责记录亲子考勤列表" , save = true)
	@Token(validateToken = false)
	@RequestMapping(value = "viewAttendanceResponsibilityList" , method = RequestMethod.POST)
	public ModelAndView viewAttendanceResponsibilityList(ViewAttendanceResponsibility entity , PageBean paramPageBean) {
		ModelAndView mav = new ModelAndView(PropertiesReadUtil.getStringProperty("viewAttendanceResponsibilityListView"));
		try {
			Map<String , String []> unLockMap = getParameterMap(request);
			DetachedCriteria dc = DetachedCriteria.forClass(ViewAttendanceResponsibility.class);
			HqlGenerateUtil.fillDetachedCriteria(dc , entity , unLockMap);
			//获取当前登录者
			String adminUserId = super.getLoginUser().getId();
			SysAdminUser user = super.getLoginUser();
			String ids = "";
			SysAdminUser sysAdminUser=this.sysAdminUserService.get(adminUserId);
			//获取当前登录者所拥有角色
			List<String> roleList = super.getLoginAdminRoles();

			if(roleList.contains(RoleConsts.TSS_COUNSELOR)||roleList.contains(RoleConsts.TSS_TEACHER)){
				dc.add(Restrictions.sqlRestriction(" adminUserId in ('" + adminUserId + "') "));
			} else{
				List<String> idsList = super.getUserIdByRoleAndSchololId(sysAdminUser.getSchoolId());
				ids = StringUtils.join(idsList, "','");
				dc.add(Restrictions.sqlRestriction(" adminUserId in ('" + ids + "') "));
			}
			dc.add(Restrictions.eq("type",1));
			dc.addOrder(Order.desc("updateTime"));
			PageBean pageBean = tssRightStatisticService.pageList(dc , paramPageBean.getPageNo() , paramPageBean.getPageSize());
			mav.addObject(super.SEARCH_MAP , unLockMap);
			mav.addObject(super.PAGE_BEAN , pageBean);
			mav.addObject("searchFormId" , SEARCH_FORM);
			mav.addObject("actionUrl" , request.getRequestURI());
			mav.addObject("pagingBar" , pageBean.getPagingBar(SEARCH_FORM));
			mav.addObject("serializeNum" , SequenceUtil.getUpperCaseUUID());
			String requestURI = StringUtils.substringBeforeLast(request.getRequestURI() , "/");
			mav.addObject("editUrl" , requestURI + "/toEditView.do");
			mav.addObject("deleteUrl" , requestURI + "/delete.do");
			mav.addObject("batchDeleteUrl" , requestURI + "/batchDelete.do");
		} catch (Exception e) {
			throw e;
		}
		return mav;
	}
	/**
	 * 获取权责记录过渡考勤列表
	 *
	 * @return
	 * @throws IOException
	 */
	@RequestLog(content = "获取权责记录过渡考勤列表" , save = true)
	@Token(validateToken = false)
	@RequestMapping(value = "transitionViewAttendanceResponsibilityList" , method = RequestMethod.POST)
	public ModelAndView transitionViewAttendanceResponsibilityList(ViewAttendanceResponsibility entity , PageBean paramPageBean) {
		ModelAndView mav = new ModelAndView(PropertiesReadUtil.getStringProperty("transitionViewAttendanceResponsibilityListView"));
		try {
			Map<String , String []> unLockMap = getParameterMap(request);
			DetachedCriteria dc = DetachedCriteria.forClass(ViewAttendanceResponsibility.class);
			HqlGenerateUtil.fillDetachedCriteria(dc , entity , unLockMap);
			//获取当前登录者
			String adminUserId = super.getLoginUser().getId();
			SysAdminUser user = super.getLoginUser();
			String ids = "";
			SysAdminUser sysAdminUser=this.sysAdminUserService.get(adminUserId);
			//获取当前登录者所拥有角色
			List<String> roleList = super.getLoginAdminRoles();

			if(roleList.contains(RoleConsts.TSS_COUNSELOR)||roleList.contains(RoleConsts.TSS_TEACHER)){
				dc.add(Restrictions.sqlRestriction(" adminUserId in ('" + adminUserId + "') "));
			} else{
				List<String> idsList = super.getUserIdByRoleAndSchololId(sysAdminUser.getSchoolId());
				ids = StringUtils.join(idsList, "','");
				dc.add(Restrictions.sqlRestriction(" adminUserId in ('" + ids + "') "));
			}
			dc.add(Restrictions.eq("type",2));
			dc.addOrder(Order.desc("updateTime"));
			PageBean pageBean = tssRightStatisticService.pageList(dc , paramPageBean.getPageNo() , paramPageBean.getPageSize());
			mav.addObject(super.SEARCH_MAP , unLockMap);
			mav.addObject(super.PAGE_BEAN , pageBean);
			mav.addObject("searchFormId" , SEARCH_FORM);
			mav.addObject("actionUrl" , request.getRequestURI());
			mav.addObject("pagingBar" , pageBean.getPagingBar(SEARCH_FORM));
			mav.addObject("serializeNum" , SequenceUtil.getUpperCaseUUID());
			String requestURI = StringUtils.substringBeforeLast(request.getRequestURI() , "/");
			mav.addObject("editUrl" , requestURI + "/toEditView.do");
			mav.addObject("deleteUrl" , requestURI + "/delete.do");
			mav.addObject("batchDeleteUrl" , requestURI + "/batchDelete.do");
		} catch (Exception e) {
			throw e;
		}
		return mav;
	}
	/**
	 * 获取权责记录餐点费列表
	 *
	 * @return
	 * @throws IOException
	 */
	@RequestLog(content = "获取权责记录餐点费列表" , save = true)
	@Token(validateToken = false)
	@RequestMapping(value = "mealFeeResponsibilityList" , method = RequestMethod.POST)
	public ModelAndView mealFeeResponsibilityList(ViewAttendanceResponsibility entity , PageBean paramPageBean) {
		ModelAndView mav = new ModelAndView(PropertiesReadUtil.getStringProperty("mealFeeResponsibilityListView"));
		try {
			Map<String , String []> unLockMap = getParameterMap(request);
			DetachedCriteria dc = DetachedCriteria.forClass(ViewAttendanceResponsibility.class);
			HqlGenerateUtil.fillDetachedCriteria(dc , entity , unLockMap);
			dc.add(Restrictions.eq("type",3));
			dc.addOrder(Order.desc("updateTime"));
			PageBean pageBean = tssRightStatisticService.pageList(dc , paramPageBean.getPageNo() , paramPageBean.getPageSize());
			mav.addObject(super.SEARCH_MAP , unLockMap);
			mav.addObject(super.PAGE_BEAN , pageBean);
			mav.addObject("searchFormId" , SEARCH_FORM);
			mav.addObject("actionUrl" , request.getRequestURI());
			mav.addObject("pagingBar" , pageBean.getPagingBar(SEARCH_FORM));
			mav.addObject("serializeNum" , SequenceUtil.getUpperCaseUUID());
			String requestURI = StringUtils.substringBeforeLast(request.getRequestURI() , "/");
			mav.addObject("editUrl" , requestURI + "/toEditView.do");
			mav.addObject("deleteUrl" , requestURI + "/delete.do");
			mav.addObject("batchDeleteUrl" , requestURI + "/batchDelete.do");
		} catch (Exception e) {
			throw e;
		}
		return mav;
	}
	/**
	 * 获取权责记录一次性物品费列表
	 *
	 * @return
	 * @throws IOException
	 */
	@RequestLog(content = "获取权责记录一次性物品费列表" , save = true)
	@Token(validateToken = false)
	@RequestMapping(value = "viewDisposableResponsibilityList" , method = RequestMethod.POST)
	public ModelAndView viewDisposableResponsibilityList(ViewDisposableResponsibility entity , PageBean paramPageBean) {
		ModelAndView mav = new ModelAndView(PropertiesReadUtil.getStringProperty("viewDisposableResponsibilityListView"));
		try {
			Map<String , String []> unLockMap = getParameterMap(request);
			DetachedCriteria dc = DetachedCriteria.forClass(ViewDisposableResponsibility.class);
			HqlGenerateUtil.fillDetachedCriteria(dc , entity , unLockMap);
			dc.addOrder(Order.desc("updateTime"));
			PageBean pageBean = tssRightStatisticService.pageList(dc , paramPageBean.getPageNo() , paramPageBean.getPageSize());
			mav.addObject(super.SEARCH_MAP , unLockMap);
			mav.addObject(super.PAGE_BEAN , pageBean);
			mav.addObject("searchFormId" , SEARCH_FORM);
			mav.addObject("actionUrl" , request.getRequestURI());
			mav.addObject("pagingBar" , pageBean.getPagingBar(SEARCH_FORM));
			mav.addObject("serializeNum" , SequenceUtil.getUpperCaseUUID());
			String requestURI = StringUtils.substringBeforeLast(request.getRequestURI() , "/");
			mav.addObject("editUrl" , requestURI + "/toEditView.do");
			mav.addObject("deleteUrl" , requestURI + "/delete.do");
			mav.addObject("batchDeleteUrl" , requestURI + "/batchDelete.do");
		} catch (Exception e) {
			throw e;
		}
		return mav;
	}
	/**
	 * 获取权责记录亲子退费列表
	 *
	 * @return
	 * @throws IOException
	 */
	@RequestLog(content = "获取权责记录亲子退费列表" , save = true)
	@Token(validateToken = false)
	@RequestMapping(value = "vewRefundResponsibilityList" , method = RequestMethod.POST)
	public ModelAndView vewRefundResponsibilityList(ViewRefundResponsibility entity , PageBean paramPageBean) {
		ModelAndView mav = new ModelAndView(PropertiesReadUtil.getStringProperty("vewRefundResponsibilityListView"));
		try {
			Map<String , String []> unLockMap = getParameterMap(request);
			DetachedCriteria dc = DetachedCriteria.forClass(ViewRefundResponsibility.class);
			HqlGenerateUtil.fillDetachedCriteria(dc , entity , unLockMap);
			dc.add(Restrictions.eq("type",5));
			dc.addOrder(Order.desc("updateTime"));
			PageBean pageBean = tssRightStatisticService.pageList(dc , paramPageBean.getPageNo() , paramPageBean.getPageSize());
			mav.addObject(super.SEARCH_MAP , unLockMap);
			mav.addObject(super.PAGE_BEAN , pageBean);
			mav.addObject("searchFormId" , SEARCH_FORM);
			mav.addObject("actionUrl" , request.getRequestURI());
			mav.addObject("pagingBar" , pageBean.getPagingBar(SEARCH_FORM));
			mav.addObject("serializeNum" , SequenceUtil.getUpperCaseUUID());
			String requestURI = StringUtils.substringBeforeLast(request.getRequestURI() , "/");
			mav.addObject("editUrl" , requestURI + "/toEditView.do");
			mav.addObject("deleteUrl" , requestURI + "/delete.do");
			mav.addObject("batchDeleteUrl" , requestURI + "/batchDelete.do");
		} catch (Exception e) {
			throw e;
		}
		return mav;
	}
	/**
	 * 获取权责记录过渡退费列表
	 *
	 * @return
	 * @throws IOException
	 */
	@RequestLog(content = "获取权责记录过渡退费列表" , save = true)
	@Token(validateToken = false)
	@RequestMapping(value = "transitionVewRefundResponsibilityList" , method = RequestMethod.POST)
	public ModelAndView transitionVewRefundResponsibilityList(ViewRefundResponsibility entity , PageBean paramPageBean) {
		ModelAndView mav = new ModelAndView(PropertiesReadUtil.getStringProperty("transitionVewRefundResponsibilityListView"));
		try {
			Map<String , String []> unLockMap = getParameterMap(request);
			DetachedCriteria dc = DetachedCriteria.forClass(ViewRefundResponsibility.class);
			HqlGenerateUtil.fillDetachedCriteria(dc , entity , unLockMap);
			dc.add(Restrictions.eq("type",6));
			dc.addOrder(Order.desc("updateTime"));
			PageBean pageBean = tssRightStatisticService.pageList(dc , paramPageBean.getPageNo() , paramPageBean.getPageSize());
			mav.addObject(super.SEARCH_MAP , unLockMap);
			mav.addObject(super.PAGE_BEAN , pageBean);
			mav.addObject("searchFormId" , SEARCH_FORM);
			mav.addObject("actionUrl" , request.getRequestURI());
			mav.addObject("pagingBar" , pageBean.getPagingBar(SEARCH_FORM));
			mav.addObject("serializeNum" , SequenceUtil.getUpperCaseUUID());
			String requestURI = StringUtils.substringBeforeLast(request.getRequestURI() , "/");
			mav.addObject("editUrl" , requestURI + "/toEditView.do");
			mav.addObject("deleteUrl" , requestURI + "/delete.do");
			mav.addObject("batchDeleteUrl" , requestURI + "/batchDelete.do");
		} catch (Exception e) {
			throw e;
		}
		return mav;
	}
	/**
	 * 获取权责记录手动扣减列表
	 *
	 * @return
	 * @throws IOException
	 */
	@RequestLog(content = "获取权责记录手动扣课列表" , save = true)
	@Token(validateToken = false)
	@RequestMapping(value = "viewManualDeductionResponsibilityList" , method = RequestMethod.POST)
	public ModelAndView viewManualDeductionResponsibilityList(ViewManualDeductionResponsibility entity , PageBean paramPageBean) {
		ModelAndView mav = new ModelAndView(PropertiesReadUtil.getStringProperty("viewManualDeductionResponsibilityListView"));
		try {
			Map<String , String []> unLockMap = getParameterMap(request);
			DetachedCriteria dc = DetachedCriteria.forClass(ViewManualDeductionResponsibility.class);
			HqlGenerateUtil.fillDetachedCriteria(dc , entity , unLockMap);
			dc.add(Restrictions.eq("type",7));
			dc.addOrder(Order.desc("updateTime"));
			PageBean pageBean = tssRightStatisticService.pageList(dc , paramPageBean.getPageNo() , paramPageBean.getPageSize());
			mav.addObject(super.SEARCH_MAP , unLockMap);
			mav.addObject(super.PAGE_BEAN , pageBean);
			mav.addObject("searchFormId" , SEARCH_FORM);
			mav.addObject("actionUrl" , request.getRequestURI());
			mav.addObject("pagingBar" , pageBean.getPagingBar(SEARCH_FORM));
			mav.addObject("serializeNum" , SequenceUtil.getUpperCaseUUID());
			String requestURI = StringUtils.substringBeforeLast(request.getRequestURI() , "/");
			mav.addObject("editUrl" , requestURI + "/toEditView.do");
			mav.addObject("deleteUrl" , requestURI + "/delete.do");
			mav.addObject("batchDeleteUrl" , requestURI + "/batchDelete.do");
		} catch (Exception e) {
			throw e;
		}
		return mav;
	}


	/**
	 * 转到编辑视图
	 * 
	 * @param entity
	 *            接收编辑参数的临时对象
	 * @param serializeNum
	 *            请求标识
	 * @return
	 */
	@RequestLog(content = "转到权责收入视图" , save = true)
	@Token(validateToken = false)
	@RequestMapping(value = "toEditView" , method = RequestMethod.GET)
	public ModelAndView toEditView(TssRightStatistic entity , @RequestParam(required = true) String serializeNum) {
		ModelAndView mav = new ModelAndView(PropertiesReadUtil.getStringProperty("tssRightStatisticEditView"));
		if(entity != null && entity.getId() != null) {
			TssRightStatistic editEntity = this.tssRightStatisticService.get(entity.getId());
			mav.addObject("editEntity" , editEntity);
			mav.addObject("editModel" , "edit");
		}else{
			mav.addObject("editModel" , "add");
		}
		mav.addObject("serializeNum" , serializeNum);
		mav.addObject("saveUrl" , StringUtils.substringBeforeLast(request.getRequestURI() , "/") + "/saveOrUpdate.do");
		return mav;
	}
	
	/**
	 * 保存编辑的对象
	 * 
	 * @param entity
	 *            被编辑对象
	 * @return
	 */
	@ResponseBody
	@RequestLog(content = "保存权责收入对象" , save = true)
	@Token(validateToken = false)
	@RequestMapping(value = "saveOrUpdate" , method = RequestMethod.POST)
	public String saveOrUpdate(TssRightStatistic entity) {
		AjaxJsonResponse ajr = new AjaxJsonResponse();
		try {
			String id=entity.getId();
			ajr.setResMsg("保存成功!");
			if(StringUtils.isNotBlank(id)){
				TssRightStatistic destEntity = this.tssRightStatisticService.get(id);
				BeanUtils.copyProperties(entity , destEntity ,"startTime","endTime","createTime");
				this.tssRightStatisticService.updateEntitiy(destEntity);
			} else {
				entity.setCreateTime(new java.sql.Timestamp(System.currentTimeMillis()));
				Serializable newId = this.tssRightStatisticService.save(entity);
				if(newId == null) {
					ajr.setResCode(301);
					ajr.setResMsg("保存失败!");
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
			ajr.setResCode(500);
			ajr.setResMsg("保存失败(" + e.getMessage() + ")!");
		}
		return ajr.jsonResponse(false);
	}
	
	/**
	 * 删除指定id的对象
	 * 
	 * @param id
	 *            需要被删除的对象id
	 * @return
	 */
	@ResponseBody
	@RequestLog(content = "删除属性" , save = true)
	@Token(validateToken = false)
	@RequestMapping(value = "delete" , method = RequestMethod.GET)
	public String delete(@StringValidator(nullable = false) String id) {
		AjaxJsonResponse ajr = new AjaxJsonResponse();
		try {
			ajr.setResMsg("删除成功!");
			if(StringUtils.isNotBlank(id)) {
				this.tssRightStatisticService.deleteEntityById(id);
			} else {
				ajr.setResMsg("删除失败!");
				ajr.setResCode(302);
			}
		} catch (Exception e) {
			e.printStackTrace();
			ajr.setResCode(500);
			ajr.setResMsg("删除失败(" + e.getMessage() + ")!");
		}
		return ajr.jsonResponse(false);
	}
	
	/**
	 * 批量删除指定id的对象
	 * 
	 * @param ids
	 *            需要被删除的对象id组成的字符串
	 * @return
	 */
	@ResponseBody
	@RequestLog(content = "删除属性" , save = true)
	@Token(validateToken = false)
	@RequestMapping(value = "batchDelete" , method = RequestMethod.GET)
	public String batchDelete(@RegexpValidator(nullable = false , regexp = "^(\\w+,?)+\\w+$") String ids) {
		AjaxJsonResponse ajr = new AjaxJsonResponse();
		try {
			ajr.setResMsg("删除成功!");
			if(StringUtils.isNotBlank(ids)) {
				boolean batchDelete = this.tssRightStatisticService.batchDelete(ids.split(","));
				if(!batchDelete) {
					ajr.setResMsg("删除失败!");
					ajr.setResCode(302);
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
			ajr.setResCode(500);
			ajr.setResMsg("删除失败(" + e.getMessage() + ")!");
		}
		return ajr.jsonResponse(false);
	}
}
